﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LuaInterface;

public class ToLuaTest04 : MonoBehaviour {

    LuaState state;

    // Use this for initialization
    void Start () {
        state = new LuaState();
        state.Start();
        LuaBinder.Bind(state);//绑定wrap（tolua文件）
        var looper = gameObject.AddComponent<LuaLooper>();
        looper.luaState = state;


        //添加lua的搜索目录
        state.AddSearchPath(Application.dataPath + "/Scripts/");
        state.AddSearchPath(Application.dataPath +
            "/LuaFramework/ToLua/Lua/");//require tolua的路径
        state.DoFile("typeof.lua");
        state.DoFile("testlua04.lua");
    }
	
	// Update is called once per frame
	void Update () {
		
        if(Input.GetMouseButtonDown(0))
        {
            state.GetFunction("StopCo").Call();
        }
	}
}
